package com.ht.service.impl;

import com.ht.domain.bo.TbDepartmentBO;
import com.ht.domain.po.TbDepartment;
import com.ht.mapper.DepartmentMapper;
import com.ht.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 科室表Service
 */
@Service
public class DepartmentServiceImpl implements DepartmentService {

    @Autowired
    private DepartmentMapper departmentMapper;

    /**
     * 查询所有科室
     * @return
     */
    @Override
    public List<TbDepartmentBO> findDepartmentAll() {
        List<TbDepartment> departmentList = departmentMapper.selectList(null);
        List<TbDepartmentBO> departmentBOList = new ArrayList<>();
        for (TbDepartment department :departmentList) {
            TbDepartmentBO departmentBO = new TbDepartmentBO(department);
            departmentBOList.add(departmentBO);
        }
        return departmentBOList;
    }
}
